

<template>
  <h1>fdfdf</h1>
</template>
<script   lang="ts">
import { LoginAdmin, queryAdmin } from "../grpc/admin_pb";
import { rpcAdminInterfaceClient } from "../grpc/admin_pb_service";
const client: rpcAdminInterfaceClient = new rpcAdminInterfaceClient(
  "http://192.168.1.193:8201"
);
 
export default {
  name: "HelloWorld",
  data() {
    return {
      msg: "Welcome to Your Vue.js App",
      code: "0",
      tim: 0,
    };
  },

  methods: {
    test() {
      let that = this;
      let loginAdmin = new LoginAdmin();
      loginAdmin.setName("zhangsan");
      loginAdmin.setCode(this.code);
      // that.client.login(
      //   loginAdmin,
      //   { token: "luonantoken" },
      //   (err, response) => {
      //     if (err) {
      //       console.log("收到异常小溪:", err);
      //     } else {
      //       //  打印返回的信息
      //       console.log(response.getAdmininfo().getToken(),"成功，结果是:", response.getAdmininfo().getName());
      //     }
      //   }
      // );
      let queryadmin = new queryAdmin();
      queryadmin.setName("abc");
       client
        .query(queryadmin, { token: "luonantoken" })
        .on("data", function (resu) {
          console.log(resu, "成功，结果是:", resu.getTotal());
          let list = resu.getDataList();
           console.log(list);
          // list.forEach((adminDBInfo) => {
          //   console.log(
          //     adminDBInfo.getAdmininfo().getName(),
          //     "的年龄是:",
          //     adminDBInfo.getAdmininfo().getAge()
          //   );
          // });
        })
        .on("end", function (resu) {
          console.log("结束了:", resu);
        });
    },
  },
};
</script>
<style>
.ep-button {
  margin: 4px;
}
</style>
